<meta charset="utf-8">
<!-- <script src="main.js"></script> -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<style>
  


</style>
<body>
    

    <div id="app">
     

      <!-- 注意使用key 属性 -->
      id:<input type="text" v-model="id" id="">
      name:<input type="text" v-model="name" id="">
      <input type="button" value="ok" @click="handle" >
      
      <p v-for="item in list" :key="item.id">
        <input type="checkbox"> {{item.id}}---{{item.name}}
      </p>
    </div>
    </body>


    <script>
        var vm = new Vue({
          el: '#app',
          data: {
            id: 0,
            name: '',
          
            list:[
              { id: 1, name: 'xiaoming'},
              { id: 2, name: 'xiaohong'},
              { id: 3, name: 'dangdang'},
            ],
            
            
          },
          methods: {
            handle() {
              this.list.unshift({id: this.id, name: this.name})
              console.log(this.list)
            }
          },
        


        });
    </script>